from datetime import date, datetime
from typing import TypedDict, Optional

from pydantic import BaseModel, EmailStr, PositiveInt, HttpUrl, validator


class User1(TypedDict):
    name: str
    email: str
    age: int

class Contact(BaseModel):
    email: EmailStr
    website: Optional[HttpUrl] = None
    followers: PositiveInt
    start_time: datetime
    event_time: date



if __name__ == '__main__':
    user1 = User1(name="Alice", age=30, email="alice@example.com")
    print(user1["name"])

    contact = Contact(
        email="alice@example.com",
        website="https://example.com",
        followers=100,
        start_time=datetime.now(),
        event_time=date.today(),
    )
    print(contact.website)